const a = function (
  { $grid, columns, data },
  { me, memory, origin },
  { xe: { commafy, get, pluck, sum } }
) {
  const form = get(origin, "1793843000839815170", {});
  const unit = form.local?.unit || 10000;
  const ret = [];
  const sumField = pluck(
    columns.filter(({ params }) => params && params.summary == "sum"),
    "field"
  );
  if (sumField.length) {
    ret.push(
      columns.map((column, columnIndex) => {
        if (columnIndex === 0) return `共 ${data.length} 条`;
        if (sumField.includes(column.field))
          return commafy((sum(data, column.field) ?? 0) / unit, { digits: 2 });
        return "";
      })
    );
  } else {
    ret.push(
      columns.map((_, columnIndex) => {
        if (columnIndex === 0) return `共 ${data.length} 条`;
        return "";
      })
    );
    $grid.setMergeFooterItems({
      row: 0,
      col: 1,
      rowspan: 1,
      colspan: columns.length - 1,
    });
  }
  const dataTotal = get(memory, `${me}.dataToTal`);
  if (dataTotal) {
    ret.push(
      columns.map(function (column, columnIndex) {
        if (columnIndex === 0) return "总计";
        if (sumField.includes(column.field))
          return commafy((dataTotal[column.field] ?? 0) / unit, { digits: 2 });
        return "";
      })
    );
  } else {
    ret.push(
      columns.map(function () {
        return "";
      })
    );
    $grid.setMergeFooterItems({
      row: 1,
      col: 1,
      rowspan: 1,
      colspan: columns.length - 1,
    });
  }
  return ret;
};
